<template>
	<view>
		<u-popup :backgroundColor="'transparent'" mode="center" v-model="show">
			<u-image :src="coverUrl" width="750" height="833"></u-image>
			<view class="text" v-if="redMoney == null">
				<text>{{number}}</text>/个
			</view>
			<view class="text" v-else>
				<text>{{redMoney}}</text>/元
			</view>
			<view v-if="redMoney == null" class="btn" @click="$u.route('/pages/user/login/login',{
				scene:'QR'
			})"></view>
			<view class="close" @click="$u.route({
				type:'tab',
				url:'/pages/tabBar/newIndex/newIndex'
			})">
			</view>
		</u-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: true,
				number: 0,
				redMoney: null,
				coverUrl: this.imageURL + 'USER/455ef08e-b776-47ed-af45-d22d1c2b1397.png'
			};
		},
		onLoad(options) {
			let scene = decodeURIComponent(options.scene);
			let sceneArray = scene.split(',')
			let store_id = sceneArray[1]
			if (uni.getStorageSync('userInfo')) {
				this.$u.route({
					type:'tab',
					url:'/pages/tabBar/newIndex/newIndex'
				})
			} else {
				this.show = true
				uni.setStorageSync('proUserId', sceneArray[0])
				this.$u.get('storeadvertisetemplate/getNewUserPacketCount').then(res => {
					this.number = res
				})
			}
		},
		methods: {
			update() {
				this.$u.get('storeadvertisetemplate/systemDrawRedPacket').then(res => {
					this.redMoney = res.redMoney
					this.coverUrl = this.imageURL + 'USER/8050a483-2033-4033-8278-32aa3ebaa686.png'
				})
			}
		}
	}
</script>

<style lang="scss">
	.btn {
		position: absolute;
		width: 290rpx;
		height: 60rpx;
		bottom: 21%;
		left: 50%;
		transform: translateX(-50%);
	}

	.text {
		position: absolute;
		bottom: 30%;
		left: 50%;
		color: #FFE3B7;
		font-size: 30rpx;

		text {
			font-size: 100rpx;
			font-weight: bold;
		}

		transform: translateX(-50%);
	}

	.close {
		position: absolute;
		bottom: 0;
		left: 50%;
		transform: translateX(-50%);
		width: 60rpx;

		height: 60rpx;
	}
</style>
